package com.spddr.pmos.jpa;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import cn.seqdata.jpa.JpaNoGeneratedObject;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@Entity
@Table(name = "river_info")
public class River extends JpaNoGeneratedObject {
	private static final long serialVersionUID = 1L;

	private River spillsInto;

	public River() {
	}

	public River(Long id) {
		super(id);
	}

	public River(Long id, String name) {
		super(id, name);
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "spills_into", nullable = false)
	@JsonSerialize(using = cn.seqdata.jackson.ObjectSerializer.IdName.class)
	public River getSpillsInto() {
		return this.spillsInto;
	}

	public void setSpillsInto(River spillsInto) {
		this.spillsInto = spillsInto;
	}
}